from django.utils import timezone
from rest_framework import serializers

from index import models

from drf_translated.serializers import TranslatedModelSerializer

class MovieSerializer(TranslatedModelSerializer):
    current_time = serializers.SerializerMethodField()
    _id = serializers.ReadOnlyField(source='id')
    _name = serializers.ReadOnlyField(source='name')

    def get_current_time(self, instance):
        return timezone.now().isoformat()

    class Meta:
        model = models.Movie

        fields = '__all__'
